﻿@model VIT.Pre.HealthCare.Models.ChargeListModel

@{
    ViewBag.Title = "Chăm sóc sức khỏe";
    Layout = "~/Views/Shared/_MainLayout.cshtml";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)}

<fieldset class="patientinfo">
    <legend>Thông tin bệnh nhân</legend>
        
    <table style="margin-right:15px">
        <tr>
            <td class="title">@Html.LabelFor(model => model.PatientId):</td>
            <td class="value"><div class="id">@Html.DisplayFor(model => model.PatientId)</div></td>
        </tr>
        <tr>
            <td class="title">@Html.LabelFor(model => model.PatientName):</td>
            <td class="value"><div class="id">@Html.DisplayFor(model => model.PatientName)</div></td>
        </tr>
        <tr>
            <td class="title">Ngày khám gần nhất:</td>
            <td class="value"><div class="id">@String.Format("{0:dd/MM/yyy}", Model.DateService)</div></td>
        </tr>
    </table>
    <table style="margin-right:15px">
        <tr>
            <td colspan="2" class="value"></td>
        </tr>
        <tr>
            <td rowspan="2" class="title" style="border-right: solid 1px #333">In hồ sơ bệnh án:</td>
            <td class="value check"><input id="allFac" type="checkbox" />Tất cả phòng khám</td>
        </tr>
        <tr>
            <td class="value"><input type="button" onclick="Print();" value="In" class="btnLogin save" style="float:left; margin-left: 15px; width: 80px"/></td>
        </tr>
    </table>
    <a href="/Charge/Detail?patientId=@Model.PatientId" class="btnSettings button" style="margin-left:20px; text-decoration:none"><img src="../../Content/images/Document-Add-icon.png" alt="Thêm mới điều trị" style="width: 58px;"/>Thêm điều trị mới</a>
    <a href="/Patient/Clinical?patientId=@Model.PatientId" class="btnSettings button" style="margin-left:20px; text-decoration:none"><img src="../../Content/images/enrollment_icon_1.png" alt="Cận lâm sàng" style="width: 58px;"/>Triệu chứng</a>
</fieldset>

<fieldset class="patientlist">
    <legend>Hồ sơ bệnh án</legend>
    <table class="table" width="100%" border="0" cellspacing="0" cellpadding="0">
        <thead>
            <tr>
                <td>Mã</td>
                <td>Ngày khám</td>
                <td>Chuẩn đoán</td>
                <td>Điều trị</td>
                <td style="width: 65px">Thời gian</td>
                <td style="width: 60px">Chi tiết</td>
                <td style="width: 25px">Xóa</td>
            </tr>
        </thead>
        
        @foreach (var o in Model.ListCharges)
        {
            <tr>
                <td>@o.Id</td>
                <td>@String.Format("{0:dd/MM/yyy}", @o.DateService)</td>
                <td>@o.DiagnosticDisplay</td>
                <td>@o.Treatments - @o.Treatments</td>
                <td>
                    @o.Days
                    <span style="display: none">@o.Diagnostic</span>
                    <span style="display: none">@o.DateOnset</span>
                    <span style="display: none">@o.DoctorId</span>
                    <span style="display: none">@o.ICDCode1</span>
                    <span style="display: none">@o.ICDCode2</span>
                    <span style="display: none">@o.ICDCode3</span>
                    <span style="display: none">@o.ICDCode4</span>
                    <span style="display: none">@o.Note</span>
                </td>
                <td style="text-align: center"><a href="/Charge/Detail?chargeId=@o.Id&patientId=@Model.PatientId"><img src="../../Content/images/edit.png"/></a></td>
                <td style="text-align: center"><a href="/Charge/Delete?id=@o.Id&patientId=@Model.PatientId"><img src="../../Content/images/DeleteRed.png"/></a></td>
            </tr>
        }
    </table>
 </fieldset>
 
  <script type="text/javascript" language="javascript">
      $(document).ready(function () {
          $("#DateService").attr('type', 'date');
          $("#DateOnset").attr('type', 'date');
      });

      function Print() {
          if ($("#allFac")[0].checked) {
              window.open('/Charge/PrintCharges?patientId=@Model.PatientId&allfacility=true', '_blank', 'width=432, height=605');
          } else {
              window.open('/Charge/PrintCharges?patientId=@Model.PatientId', '_blank', 'width=432, height=605');
          }
      }
</script>